package com.itheima.config;
//用来注册拦截器

import com.itheima.interceptor.CheckInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/*
注册拦截器:
        拦截器既可以拦截,也可以放行
            /* 代表一级路径
            /** 代表任意路径
            /empls/* 代表empls下的一级路径
            /empls/** 代表empls下的任意路径
 */

@Configuration
public class WbeConfig implements WebMvcConfigurer {
    @Autowired
    private CheckInterceptor checkInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(checkInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
    }
}
